When the gvariant is G_VARIANT_TYPE_BYTESTRING we need to duplicate
the data we get from g_variant_get_fixed_array(), otherwise we will
double-free it when we later free sign->secret_key.
}
else if (g_variant_is_of_type (secret_key, G_VARIANT_TYPE_BYTESTRING))
{
- secret_key_buf
- = (guchar *)g_variant_get_fixed_array (secret_key, &n_elements, sizeof (guchar));
+ const guchar *data = g_variant_get_fixed_array (secret_key, &n_elements, sizeof (guchar));
+ secret_key_buf = g_memdup (data, n_elements);
}
else
{
}
else if (g_variant_is_of_type (secret_key, G_VARIANT_TYPE_BYTESTRING))
{
- secret_key_buf
- = (guchar *)g_variant_get_fixed_array (secret_key, &n_elements, sizeof (guchar));
+ const guchar *data = g_variant_get_fixed_array (secret_key, &n_elements, sizeof (guchar));
+ secret_key_buf = g_memdup (data, n_elements);
}
else
{